<!DOCTYPE html>
<html lang="en">
<head>
    <meta charset="UTF-8">
    <meta http-equiv="X-UA-Compatible" content="IE=edge">
    <meta name="viewport" content="width=device-width, initial-scale=1.0">
    <title>Document</title>
</head>
<body>
    <button id="btn">小猫</button>
    <div>123</div>
    <script>
        var btn = document.getElementById('btn');//获得了事件源
        btn.onclick = function(){
        //一个对象被点击了，就做了一件事
            alert('吃鱼');
        }
        var div1 = document.querySelector('div');
        div1.onclick = function(){
            console.log('我被选中了')
        }
    </script>
</body>
</html>